# $Id: PKGBUILD 164810 2012-08-06 13:29:17Z allan $
# Maintainer: Allan McRae <allan@archlinux.org>
# Contributor: judd <jvinet@zeroflux.org>

pkgname=flex
pkgver=2.5.37
pkgrel=1
pkgdesc="A tool for generating text-scanning programs"
arch=('i686' 'x86_64')
url="http://flex.sourceforge.net"
license=('custom')
groups=('base-devel')
depends=('glibc' 'm4' 'sh')
install=flex.install
source=(http://downloads.sourceforge.net/sourceforge/flex/flex-$pkgver.tar.bz2
        lex.sh)
md5sums=('c75940e1fc25108f2a7b3ef42abdae06'
         'f725259ec23a9e87ee29e2ef82eda9a5')

build() {
  cd $srcdir/$pkgname-$pkgver
  ./configure --prefix=/usr
  make
}

check() {
  cd $srcdir/$pkgname-$pkgver
  
  # these tests used features removed in bison-2.6
  sed -i -e '/test-bison-yylloc/d' -e '/test-bison-yylval/d' tests/Makefile.in

  make check
}

package() {
  cd $srcdir/$pkgname-$pkgver

  make DESTDIR=$pkgdir install
  install -Dm755 $srcdir/lex.sh $pkgdir/usr/bin/lex

  install -Dm644 COPYING \
  	$pkgdir/usr/share/licenses/$pkgname/license.txt
}

